package com.ruoyi.yqhs.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.yqhs.domain.YqhsYwsjcw;
import com.ruoyi.yqhs.service.IYqhsYwsjcwService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 运维数据错误Controller
 * 
 * @author ruoyi
 * @date 2025-08-31
 */
@RestController
@RequestMapping("/yqhs/ywsjcw")
public class YqhsYwsjcwController extends BaseController
{
    @Autowired
    private IYqhsYwsjcwService yqhsYwsjcwService;

    /**
     * 查询运维数据错误列表
     */
    @PreAuthorize("@ss.hasPermi('yqhs:ywsjcw:list')")
    @GetMapping("/list")
    public TableDataInfo list(YqhsYwsjcw yqhsYwsjcw)
    {
        startPage();
        List<YqhsYwsjcw> list = yqhsYwsjcwService.selectYqhsYwsjcwList(yqhsYwsjcw);
        return getDataTable(list);
    }

    /**
     * 导出运维数据错误列表
     */
    @PreAuthorize("@ss.hasPermi('yqhs:ywsjcw:export')")
    @Log(title = "运维数据错误", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, YqhsYwsjcw yqhsYwsjcw)
    {
        List<YqhsYwsjcw> list = yqhsYwsjcwService.selectYqhsYwsjcwList(yqhsYwsjcw);
        ExcelUtil<YqhsYwsjcw> util = new ExcelUtil<YqhsYwsjcw>(YqhsYwsjcw.class);
        util.exportExcel(response, list, "运维数据错误数据");
    }

    /**
     * 获取运维数据错误详细信息
     */
    @PreAuthorize("@ss.hasPermi('yqhs:ywsjcw:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(yqhsYwsjcwService.selectYqhsYwsjcwById(id));
    }

    /**
     * 新增运维数据错误
     */
    @PreAuthorize("@ss.hasPermi('yqhs:ywsjcw:add')")
    @Log(title = "运维数据错误", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YqhsYwsjcw yqhsYwsjcw)
    {
        return toAjax(yqhsYwsjcwService.insertYqhsYwsjcw(yqhsYwsjcw));
    }

    /**
     * 修改运维数据错误
     */
    @PreAuthorize("@ss.hasPermi('yqhs:ywsjcw:edit')")
    @Log(title = "运维数据错误", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YqhsYwsjcw yqhsYwsjcw)
    {
        return toAjax(yqhsYwsjcwService.updateYqhsYwsjcw(yqhsYwsjcw));
    }

    /**
     * 删除运维数据错误
     */
    @PreAuthorize("@ss.hasPermi('yqhs:ywsjcw:remove')")
    @Log(title = "运维数据错误", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(yqhsYwsjcwService.deleteYqhsYwsjcwByIds(ids));
    }
}
